home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
PsL Monthly 1993 December
/
PSL Monthly Shareware CD-ROM (December 1993).iso
/
prgmming
/
dos
/
c
/
ww_tv.exe
/
EDITORS.H
< prev
next >
Wrap
C/C++ Source or Header
|
1992-08-21
|
16KB
|
580 lines
/* ------------------------------------------------------------------------*/
/* */
/* EDITORS.H */
/* */
/* Copyright (c) Borland International 1991 */
/* All Rights Reserved. */
/* */
/* defines the classes TIndicator, TEditor, TMemo, TFileEditor, */
/* and TEditWindow */
/* */
/* Primatech Modification History: */
/* */
/* 11-06-91 JLS Made following changes to TEditor: */
/* Made some functions inline */
/* Made data members private or protected */
/* Made setBufLen() protected */
/* */
/* 11-07-91 JLS Made the following changes to TEditor: */
/* Made the Boolean flags public again */
/* */
/* 11-12-91 JLS Made insertText() into an inline function in the */
/* TEditor class. */
/* */
/* 11-19-91 JLS Added alwaysWrap parm to insertBuffer() and */
/* deleteSelect() */
/* */
/* 12-02-91 JLS Made scrollTo(int,int) into a virtual function */
/* */
/* 01-02-92 JLS Added shutDown() to TFileEditor as in BC++ 3.0 */
/* */
/* 05-20-92 JLS Made bufChar() and bufPtr() const functions */
/* */
/* 06-08-92 JLS Added "BaseClass" typedef to TEditor class */
/* */
/* 07-05-92 JLS Synced with TV1.03 (BC3.10) */
/* */
/* ------------------------------------------------------------------------*/
#if !defined( __DIR_H )
#include <dir.h>
#endif // __DIR_H
#if !defined( __STRING_H )
#include <string.h>
#endif // __STRING_H
#if !defined( __LIMITS_H )
#include <limits.h>
#endif // __LIMITS_H
#pragma option -Vo-
#if defined( __BCOPT__ ) && __BCPLUSPLUS__ > 0x0300
#pragma option -po-
#endif
#if !defined( __EDIT_COMMAND_CODES )
#define __EDIT_COMMAND_CODES
const
ufUpdate = 0x01,
ufLine = 0x02,
ufView = 0x04;
const
smExtend = 0x01,
smDouble = 0x02;
const unsigned
sfSearchFailed = 0xFFFF;
const
cmSave = 80,
cmSaveAs = 81,
cmFind = 82,
cmReplace = 83,
cmSearchAgain = 84,
cmReplaceAgain = 85,
cmToggleWrap = 86,
cmToggleAutoMargin = 87;
const
cmCharLeft = 500,
cmCharRight = 501,
cmWordLeft = 502,
cmWordRight = 503,
cmLineStart = 504,
cmLineEnd = 505,
cmLineUp = 506,
cmLineDown = 507,
cmPageUp = 508,
cmPageDown = 509,
cmTextStart = 510,
cmTextEnd = 511,
cmNewLine = 512,
cmBackSpace = 513,
cmDelChar = 514,
cmDelWord = 515,
cmDelStart = 516,
cmDelEnd = 517,
cmDelLine = 518,
cmInsMode = 519,
cmStartSelect = 520,
cmHideSelect = 521,
cmIndentMode = 522,
cmUpdateTitle = 523,
cmWindowStart = 524,
cmWindowEnd = 525;
const
edOutOfMemory = 0,
edReadError = 1,
edWriteError = 2,
edCreateError = 3,
edSaveModify = 4,
edSaveUntitled = 5,
edSaveAs = 6,
edFind = 7,
edSearchFailed = 8,
edReplace = 9,
edReplacePrompt = 10;
const
efCaseSensitive = 0x0001,
efWholeWordsOnly = 0x0002,
efPromptOnReplace = 0x0004,
efReplaceAll = 0x0008,
efDoReplace = 0x0010,
efBackupFiles = 0x0100;
const
maxLineLength = 256;
#endif // __EDIT_COMMAND_CODES
typedef ushort (*TEditorDialog)( int, ... );
ushort defEditorDialog( int dialog, ... );
#if defined( Uses_TIndicator ) && !defined( __TIndicator )
#define __TIndicator
class far TRect;
class TIndicator : public TView
{
public:
TIndicator( const TRect& );
virtual void draw();
virtual TPalette& getPalette() const;
virtual void setState( ushort, Boolean );
void setValue( const TPoint&, Boolean );
protected:
TPoint location;
Boolean modified;
private:
static const char near dragFrame;
static const char near normalFrame;
virtual const char *streamableName() const
{ return name; }
protected:
TIndicator( StreamableInit );
public:
static const char * const near name;
static TStreamable *build();
};
inline ipstream& operator >> ( ipstream& is, TIndicator& cl )
{ return is >> (TStreamable&)cl; }
inline ipstream& operator >> ( ipstream& is, TIndicator*& cl )
{ return is >> (void *&)cl; }
inline opstream& operator << ( opstream& os, TIndicator& cl )
{ return os << (TStreamable&)cl; }
inline opstream& operator << ( opstream& os, TIndicator* cl )
{ return os << (TStreamable *)cl; }
#endif // Uses_TIndicator
#if defined( Uses_TEditor ) && !defined( __TEditor )
#define __TEditor
class far TRect;
class far TScrollBar;
class far TIndicator;
class far TEvent;
enum WordWrapState {wwsError, wwsNoWrap, wwsDidWrap};
#define TEditorBase TView
class TEditor : public TEditorBase
{
public:
friend void genRefs();
TEditor( const TRect&, TScrollBar *, TScrollBar *, TIndicator *, ushort );
virtual ~TEditor();
virtual void shutDown();
char bufChar( ushort ) const;
ushort bufPtr( ushort ) const;
virtual void changeBounds( const TRect& );
virtual void convertEvent( TEvent& );
Boolean cursorVisible();
void deleteSelect(Boolean alwaysWrap=False);
virtual void doneBuffer();
virtual void draw();
virtual TPalette& getPalette() const;
virtual void handleEvent( TEvent& );
virtual void initBuffer();
Boolean insertBuffer( char *, ushort, ushort, Boolean, Boolean, Boolean alwaysWrap=False );
virtual Boolean insertFrom( TEditor * );
Boolean insertText( const void *, ushort, Boolean );
virtual void scrollTo( int, int );
Boolean search( const char *, ushort );
virtual Boolean setBufSize( ushort );
void setCmdState( ushort, Boolean );
void setSelect( ushort, ushort, Boolean);
virtual void setState( ushort, Boolean );
void trackCursor( Boolean );
void undo();
virtual void updateCommands();
virtual Boolean valid( ushort );
int charPos( ushort, ushort );
ushort charPtr( ushort, int );
Boolean clipCopy();
void clipCut();
void clipPaste();
void deleteRange( ushort, ushort, Boolean );
void doUpdate();
void doSearchReplace();
void drawLines( int, int, ushort );
void formatLine(void *, ushort, int, ushort );
void find();
ushort getMousePtr( TPoint );
Boolean hasSelection() {return Boolean(selStart != selEnd);}
void hideSelect();
Boolean isClipboard() const {return Boolean(clipboard == this);}
ushort lineEnd( ushort );
ushort lineMove( ushor